package com.unicomcz.article;

import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.unicomcz.DetailPageAction;
import com.unicomcz.login.UserInfo;

public class ArticleListAction extends DetailPageAction
{
    public String getSqlStr() {
        HttpServletRequest request = ServletActionContext.getRequest();
        HttpSession session = request.getSession();
        UserInfo userInfo = (UserInfo)session.getAttribute("USER_INFO");
        String sqlStr="SELECT art_title,to_char(oper_time,'yyyy-mm-dd'),art_id" + 
                " FROM dls_news WHERE status=0 and art_type in ('"+userInfo.getUserLevel()+"','all','index') ORDER BY oper_time DESC";
        return sqlStr;
    }
    public Object[] getParams() {
        return new Object[]{};
    }
    protected void regQueryParam() throws Exception{
    }
    protected void rs2List(ResultSet rs,List out) throws Exception{
        Article a = new Article();
        a.setTitle(rs.getString(1));
        a.setArtId(rs.getString(3));
        a.setOperTime(rs.getString(2));
        out.add(a);
        
    }

}
